From 7e98273ff35afa764ce3282ecf5c241c9211db46 Mon Sep 17 00:00:00 2001 From: Romain Boman <romain.boman@gmail.com> Date: Wed, 24 May 2023 15:41:52 +0200 Subject: [PATCH] clang-format --- heat/src/heat.h | 2 +- heat/src/wBoundary.cpp | 4 +-- heat/src/wBoundary.h | 2 +- heat/src/wCompiledFct.h | 2 +- heat/src/wDirichlet.cpp | 4 +-- heat/src/wDirichlet.h | 2 +- heat/src/wDisplayHook.h | 2 +- heat/src/wExtractor.h | 2 +- heat/src/wHeatTerm.h | 2 +- heat/src/wMedium.cpp | 4 +-- heat/src/wMedium.h | 2 +- heat/src/wPeriodic.cpp | 4 +-- heat/src/wPeriodic.h | 4 +-- heat/src/wProblem.h | 2 +- heat/src/wSolver.cpp | 57 +++++++++++++++++----------------- heat/src/wSolver.h | 2 +- heat/src/wSource.cpp | 4 +-- heat/src/wSource.h | 2 +- waves/attic/wDof.h | 6 ++-- waves/attic/wField.h | 2 +- waves/attic/wSolver1.h | 2 +- waves/src/wBoundary.cpp | 4 +-- waves/src/wBoundary.h | 2 +- waves/src/wDisplayHook.h | 2 +- waves/src/wForwardEuler.cpp | 8 ++--- waves/src/wForwardEuler.h | 2 +- waves/src/wMedium.cpp | 4 +-- waves/src/wMedium.h | 2 +- waves/src/wNewmark.cpp | 6 ++-- waves/src/wNewmark.h | 2 +- waves/src/wProblem.h | 2 +- waves/src/wRungeKutta.cpp | 29 +++++++++-------- waves/src/wRungeKutta.h | 2 +- waves/src/wSource.cpp | 14 ++++----- waves/src/wSource.h | 2 +- waves/src/wTimeIntegration.cpp | 12 +++---- waves/src/wTimeIntegration.h | 4 +-- waves/src/wWaveTerm.h | 2 +- waves/src/waves.h | 2 +- 39 files changed, 109 insertions(+), 105 deletions(-) diff --git a/heat/src/heat.h b/heat/src/heat.h index ef7f461..6eb386d 100644 --- a/heat/src/heat.h +++ b/heat/src/heat.h @@ -54,4 +54,4 @@ class HeatTerm; class DisplayHook; }; // namespace heat -#endif //HEAT_H +#endif // HEAT_H diff --git a/heat/src/wBoundary.cpp b/heat/src/wBoundary.cpp index 2ec2221..4de424d 100644 --- a/heat/src/wBoundary.cpp +++ b/heat/src/wBoundary.cpp @@ -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) { - //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) { - //pbl.bnds.push_back(this); + // pbl.bnds.push_back(this); } void Boundary::write(std::ostream &out) const diff --git a/heat/src/wBoundary.h b/heat/src/wBoundary.h index 3c0b867..24a113d 100644 --- a/heat/src/wBoundary.h +++ b/heat/src/wBoundary.h @@ -47,4 +47,4 @@ public: } // namespace heat -#endif //WBOUNDARY_H +#endif // WBOUNDARY_H diff --git a/heat/src/wCompiledFct.h b/heat/src/wCompiledFct.h index f8d1392..50a0970 100644 --- a/heat/src/wCompiledFct.h +++ b/heat/src/wCompiledFct.h @@ -101,4 +101,4 @@ public: }; // namespace heat -#endif //WCOMPILEDFCT_H +#endif // WCOMPILEDFCT_H diff --git a/heat/src/wDirichlet.cpp b/heat/src/wDirichlet.cpp index 932ee6f..3231011 100644 --- a/heat/src/wDirichlet.cpp +++ b/heat/src/wDirichlet.cpp @@ -31,7 +31,7 @@ Dirichlet::Dirichlet(std::shared_ptr<MshData> _msh, int no, double _val) : Group auto it = std::unique(nodes.begin(), nodes.end()); 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) @@ -43,7 +43,7 @@ Dirichlet::Dirichlet(std::shared_ptr<MshData> _msh, std::string const &name, dou auto it = std::unique(nodes.begin(), nodes.end()); nodes.resize(std::distance(nodes.begin(), it)); - //pbl.dBCs.push_back(this); + // pbl.dBCs.push_back(this); } /** diff --git a/heat/src/wDirichlet.h b/heat/src/wDirichlet.h index 6ebf97b..b201700 100644 --- a/heat/src/wDirichlet.h +++ b/heat/src/wDirichlet.h @@ -52,4 +52,4 @@ public: } // namespace heat -#endif //WDIRICHLET_H +#endif // WDIRICHLET_H diff --git a/heat/src/wDisplayHook.h b/heat/src/wDisplayHook.h index 58dcbaf..1972fd4 100644 --- a/heat/src/wDisplayHook.h +++ b/heat/src/wDisplayHook.h @@ -38,4 +38,4 @@ public: } // namespace heat -#endif //WDISPLAYHOOK_H +#endif // WDISPLAYHOOK_H diff --git a/heat/src/wExtractor.h b/heat/src/wExtractor.h index fb79c37..8f88ba1 100644 --- a/heat/src/wExtractor.h +++ b/heat/src/wExtractor.h @@ -47,4 +47,4 @@ public: } // namespace heat -#endif //WEXTRACTOR_H +#endif // WEXTRACTOR_H diff --git a/heat/src/wHeatTerm.h b/heat/src/wHeatTerm.h index 12f9bc5..53c5e4f 100644 --- a/heat/src/wHeatTerm.h +++ b/heat/src/wHeatTerm.h @@ -42,4 +42,4 @@ public: }; } // namespace heat -#endif //WHEATTERM_H +#endif // WHEATTERM_H diff --git a/heat/src/wMedium.cpp b/heat/src/wMedium.cpp index ad307a6..6586787 100644 --- a/heat/src/wMedium.cpp +++ b/heat/src/wMedium.cpp @@ -24,7 +24,7 @@ Medium::Medium(std::shared_ptr<MshData> _msh, int no, std::shared_ptr<Fct2> _k, double _rhoc) : Group(_msh, no), 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, @@ -32,7 +32,7 @@ Medium::Medium(std::shared_ptr<MshData> _msh, std::string const &name, k(_k), rhoc(_rhoc) { std::cout << "tag=" << *tag << std::endl; - //pbl.media.push_back(this); + // pbl.media.push_back(this); } void Medium::write(std::ostream &out) const diff --git a/heat/src/wMedium.h b/heat/src/wMedium.h index 5ba9b42..874818c 100644 --- a/heat/src/wMedium.h +++ b/heat/src/wMedium.h @@ -48,4 +48,4 @@ public: } // namespace heat -#endif //WMEDIUM_H +#endif // WMEDIUM_H diff --git a/heat/src/wPeriodic.cpp b/heat/src/wPeriodic.cpp index 5693081..93c9b5c 100644 --- a/heat/src/wPeriodic.cpp +++ b/heat/src/wPeriodic.cpp @@ -45,7 +45,7 @@ NodePair::NodePair(Node *_n, Node *_d, double tol) : n(_n), d(_d) Periodic::Periodic(std::shared_ptr<heat::Problem> _pbl, double _TM, double _dTxM, double _dTyM) : wSharedObject(), pbl(_pbl) { - //pbl->pdic = this; + // pbl->pdic = this; reset(_TM, _dTxM, _dTyM); verbose = false; } @@ -70,7 +70,7 @@ void Periodic::init() if (!LR.empty()) return; - //std::cout << "Periodic::init()\n"; + // std::cout << "Periodic::init()\n"; // build a list of nodes related to all the media if (verbose) diff --git a/heat/src/wPeriodic.h b/heat/src/wPeriodic.h index 0e1d4c9..ebb5c48 100644 --- a/heat/src/wPeriodic.h +++ b/heat/src/wPeriodic.h @@ -39,7 +39,7 @@ public: NodePair(Node *_n, Node *_d, double tol = 1e-12); friend HEAT_API std::ostream &operator<<(std::ostream &out, NodePair const &obj); }; -#endif //SWIG +#endif // SWIG /** * @brief manages periodic BCs @@ -79,4 +79,4 @@ private: } // namespace heat -#endif //WPERIODIC_H +#endif // WPERIODIC_H diff --git a/heat/src/wProblem.h b/heat/src/wProblem.h index 875aa6d..5fbda64 100644 --- a/heat/src/wProblem.h +++ b/heat/src/wProblem.h @@ -64,4 +64,4 @@ public: } // namespace heat -#endif //WPROBLEM_H +#endif // WPROBLEM_H diff --git a/heat/src/wSolver.cpp b/heat/src/wSolver.cpp index 0148904..96c7f60 100644 --- a/heat/src/wSolver.cpp +++ b/heat/src/wSolver.cpp @@ -146,8 +146,8 @@ void Solver::start(MshExport *mshWriter) // K matrix assembly Eigen::SparseMatrix<double, Eigen::RowMajor> K(msh->nodes.size(), msh->nodes.size()); buildK(K, rhs_); - //tomatlab("K.txt", K); - //throw std::runtime_error("stop!"); + // tomatlab("K.txt", K); + // throw std::runtime_error("stop!"); tms["Kass"].stop(); tms["BCs"].start(); @@ -162,7 +162,7 @@ void Solver::start(MshExport *mshWriter) dBC->apply(rhs); } tms["BCs"].stop(); - //std::cout << rhs << "\n"; + // std::cout << rhs << "\n"; // residual calculation tms["residual"].start(); @@ -176,7 +176,7 @@ void Solver::start(MshExport *mshWriter) Eigen::VectorXd qint2; buildqint(qint2); // calcul de q_int par integration du flux sur l'elem double normdiff = (qint - qint2).norm(); - //if(verbose>1) + // if(verbose>1) std::cout << "norm diff=" << normdiff << '\n'; } @@ -256,7 +256,8 @@ void Solver::start(MshExport *mshWriter) Eigen::Vector2d qM = Eigen::Vector2d::Zero(); 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) return; //std::cout << "processing element #" << e->no << "\n"; @@ -295,8 +296,7 @@ void Solver::start(MshExport *mshWriter) tbb::spin_mutex::scoped_lock lock(mutex); Vtot += V; - qM += qV; // qM = qM + qV - }); + qM += qV; // qM = qM + qV }); } qM /= Vtot; @@ -371,7 +371,8 @@ void Solver::buildK(Eigen::SparseMatrix<double, Eigen::RowMajor> &K2, Eigen::Map { if (verbose > 1) 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) return; //std::cout << "processing element #" << e->no << "\n"; @@ -388,8 +389,7 @@ void Solver::buildK(Eigen::SparseMatrix<double, Eigen::RowMajor> &K2, Eigen::Map Node *nodj = e->nodes[jj]; T.push_back(Eigen::Triplet<double>(rows[nodi->row], nodj->row, Ke(ii, jj))); } - } - }); + } }); } } else @@ -406,7 +406,8 @@ void Solver::buildK(Eigen::SparseMatrix<double, Eigen::RowMajor> &K2, Eigen::Map if (verbose > 1) std::cout << "\tprocessing " << *mat << '\n'; std::for_each(mat->tag->elems.begin(), mat->tag->elems.end(), - [&](Element *e) { + [&](Element *e) + { if (e->type() != ElType::TRI3) return; 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 Eigen::MatrixXd Ke = HeatTerm::build(*e, T1, *mat->k, false); // 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) { Node *nodi = e->nodes[ii]; @@ -520,8 +521,9 @@ void Solver::buildK(Eigen::SparseMatrix<double, Eigen::RowMajor> &K2, Eigen::Map double rhocM_Vtot = 0; for (auto mat : pbl->media) { - //std::cout << "\tprocessing " << *mat << '\n'; - tbb::parallel_for_each(mat->tag->elems.begin(), mat->tag->elems.end(), [&](Element *e) { + // std::cout << "\tprocessing " << *mat << '\n'; + tbb::parallel_for_each(mat->tag->elems.begin(), mat->tag->elems.end(), [&](Element *e) + { if (e->type() != ElType::TRI3) return; //std::cout << "processing element #" << e->no << "\n"; @@ -538,8 +540,7 @@ void Solver::buildK(Eigen::SparseMatrix<double, Eigen::RowMajor> &K2, Eigen::Map Vtot += Ce(jj); rhocM_Vtot += (mat->rhoc) * Ce(jj); - } - }); + } }); } rhs(n1->row) = rhocM_Vtot * TM; if (verbose > 1) @@ -558,7 +559,7 @@ void Solver::buildK(Eigen::SparseMatrix<double, Eigen::RowMajor> &K2, Eigen::Map { 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) { if (it.row() == it.col()) @@ -592,7 +593,8 @@ void Solver::buildqint(Eigen::VectorXd &qint) { if (verbose > 1) 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) return; //std::cout << "processing element #" << e->no << "\n"; @@ -605,8 +607,7 @@ void Solver::buildqint(Eigen::VectorXd &qint) { Node *nodi = e->nodes[ii]; qint(nodi->row) += qe(ii); - } - }); + } }); } if (!pbl->dBCs.empty()) @@ -640,8 +641,9 @@ void Solver::builds(Eigen::Map<Eigen::VectorXd> &s) for (auto src : pbl->srcs) { - //std::cout << "\tprocessing " << *src << '\n'; - tbb::parallel_for_each(src->tag->elems.begin(), src->tag->elems.end(), [&](Element *e) { + // std::cout << "\tprocessing " << *src << '\n'; + tbb::parallel_for_each(src->tag->elems.begin(), src->tag->elems.end(), [&](Element *e) + { if (e->type() != ElType::TRI3 && e->type() != ElType::LINE2) return; //std::cout << "processing element #" << e->no << "\n"; @@ -656,8 +658,7 @@ void Solver::builds(Eigen::Map<Eigen::VectorXd> &s) { Node *nodi = e->nodes[ii]; s(nodi->row) += se(ii); - } - }); + } }); } if (verbose > 1) @@ -679,8 +680,9 @@ void Solver::buildq(Eigen::Map<Eigen::VectorXd> &q) for (auto bnd : pbl->bnds) { - //std::cout << "\tprocessing " << *src << '\n'; - tbb::parallel_for_each(bnd->tag->elems.begin(), bnd->tag->elems.end(), [&](Element *e) { + // std::cout << "\tprocessing " << *src << '\n'; + tbb::parallel_for_each(bnd->tag->elems.begin(), bnd->tag->elems.end(), [&](Element *e) + { if (e->type() != ElType::LINE2) return; //std::cout << "processing element #" << e->no << "\n"; @@ -695,8 +697,7 @@ void Solver::buildq(Eigen::Map<Eigen::VectorXd> &q) { Node *nodi = e->nodes[ii]; q(nodi->row) += qe(ii); - } - }); + } }); } if (verbose > 1) diff --git a/heat/src/wSolver.h b/heat/src/wSolver.h index bd83c28..bcd624d 100644 --- a/heat/src/wSolver.h +++ b/heat/src/wSolver.h @@ -76,4 +76,4 @@ private: } // namespace heat -#endif //WSOLVER_H +#endif // WSOLVER_H diff --git a/heat/src/wSource.cpp b/heat/src/wSource.cpp index 149c18d..5429e8c 100644 --- a/heat/src/wSource.cpp +++ b/heat/src/wSource.cpp @@ -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) { - //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) { - //pbl.srcs.push_back(this); + // pbl.srcs.push_back(this); } void Source::write(std::ostream &out) const diff --git a/heat/src/wSource.h b/heat/src/wSource.h index b83b726..bbaa0f0 100644 --- a/heat/src/wSource.h +++ b/heat/src/wSource.h @@ -49,4 +49,4 @@ public: } // namespace heat -#endif //WSOURCE_H +#endif // WSOURCE_H diff --git a/waves/attic/wDof.h b/waves/attic/wDof.h index 11a552d..26fcd69 100644 --- a/waves/attic/wDof.h +++ b/waves/attic/wDof.h @@ -35,9 +35,9 @@ public: Dofs() : wObject(), dofs(0) {} //~Dofs(); - //void add(Dof &dof); + // void add(Dof &dof); 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 diff --git a/waves/attic/wField.h b/waves/attic/wField.h index 35ad574..a3ecc99 100644 --- a/waves/attic/wField.h +++ b/waves/attic/wField.h @@ -38,4 +38,4 @@ public: virtual void write(std::ostream &out) const; }; -#endif //WFIELD_H +#endif // WFIELD_H diff --git a/waves/attic/wSolver1.h b/waves/attic/wSolver1.h index 9b1afd8..ecb648b 100644 --- a/waves/attic/wSolver1.h +++ b/waves/attic/wSolver1.h @@ -14,4 +14,4 @@ public: virtual void write(std::ostream &out) const; }; -#endif //WSOLVER1_H +#endif // WSOLVER1_H diff --git a/waves/src/wBoundary.cpp b/waves/src/wBoundary.cpp index 52238ca..90272c2 100644 --- a/waves/src/wBoundary.cpp +++ b/waves/src/wBoundary.cpp @@ -21,12 +21,12 @@ using namespace waves; Boundary::Boundary(std::shared_ptr<MshData> _msh, int no, double _c) : Group(_msh, no), c(_c) { - //pbl.bnds.push_back(this); + // pbl.bnds.push_back(this); } Boundary::Boundary(std::shared_ptr<MshData> _msh, std::string const &name, double _c) : Group(_msh, name), c(_c) { - //pbl.bnds.push_back(this); + // pbl.bnds.push_back(this); } void Boundary::write(std::ostream &out) const diff --git a/waves/src/wBoundary.h b/waves/src/wBoundary.h index 98ef337..38084d5 100644 --- a/waves/src/wBoundary.h +++ b/waves/src/wBoundary.h @@ -43,4 +43,4 @@ public: }; } // namespace waves -#endif //WBOUNDARY_H +#endif // WBOUNDARY_H diff --git a/waves/src/wDisplayHook.h b/waves/src/wDisplayHook.h index 859859d..4dad02c 100644 --- a/waves/src/wDisplayHook.h +++ b/waves/src/wDisplayHook.h @@ -38,4 +38,4 @@ public: } // namespace waves -#endif //WDISPLAYHOOK_H +#endif // WDISPLAYHOOK_H diff --git a/waves/src/wForwardEuler.cpp b/waves/src/wForwardEuler.cpp index 9efb91b..810bff0 100644 --- a/waves/src/wForwardEuler.cpp +++ b/waves/src/wForwardEuler.cpp @@ -54,7 +54,7 @@ void ForwardEuler::start(MshExport *mshWriter) // setup results Results results; results.scalars_at_nodes["u"] = &u1; - //results.scalars_at_nodes["v"] = &v1; + // results.scalars_at_nodes["v"] = &v1; // time integration @@ -68,11 +68,11 @@ void ForwardEuler::start(MshExport *mshWriter) while (t < ttot && !stopit) { - //if(verbose) std::cout << "nt " << nt << " t=" << t << "\n"; + // if(verbose) std::cout << "nt " << nt << " t=" << t << "\n"; if (verbose) std::cout << "nt " << nt << " t=" << t << " stopit=" << stopit << "\n"; - //std::for_each(msh->srcs.begin(), msh->srcs.end(), [&](Source *s) { s->apply(t, u1); }); + // std::for_each(msh->srcs.begin(), msh->srcs.end(), [&](Source *s) { s->apply(t, u1); }); for (auto s : pbl->srcs) s->apply(t, u1); @@ -90,7 +90,7 @@ void ForwardEuler::start(MshExport *mshWriter) if (nt % savefreq == 0) { - //std::cout << "nt " << nt << " t=" << t << "\n"; + // std::cout << "nt " << nt << " t=" << t << "\n"; results.time = t; if (wgmsh == Wgmsh::WG_ONE) { diff --git a/waves/src/wForwardEuler.h b/waves/src/wForwardEuler.h index 1be5443..f849783 100644 --- a/waves/src/wForwardEuler.h +++ b/waves/src/wForwardEuler.h @@ -39,4 +39,4 @@ public: } // namespace waves -#endif //WFORWARDEULER_H +#endif // WFORWARDEULER_H diff --git a/waves/src/wMedium.cpp b/waves/src/wMedium.cpp index af87497..09488f7 100644 --- a/waves/src/wMedium.cpp +++ b/waves/src/wMedium.cpp @@ -21,12 +21,12 @@ using namespace waves; Medium::Medium(std::shared_ptr<MshData> _msh, int no, double _c) : Group(_msh, no), c(_c) { - //pbl.media.push_back(this); + // pbl.media.push_back(this); } Medium::Medium(std::shared_ptr<MshData> _msh, std::string const &name, double _c) : Group(_msh, name), c(_c) { - //pbl.media.push_back(this); + // pbl.media.push_back(this); } void Medium::write(std::ostream &out) const diff --git a/waves/src/wMedium.h b/waves/src/wMedium.h index a3e370a..e22b7c5 100644 --- a/waves/src/wMedium.h +++ b/waves/src/wMedium.h @@ -44,4 +44,4 @@ public: }; } // namespace waves -#endif //WMEDIUM_H +#endif // WMEDIUM_H diff --git a/waves/src/wNewmark.cpp b/waves/src/wNewmark.cpp index 9195212..48f3c54 100644 --- a/waves/src/wNewmark.cpp +++ b/waves/src/wNewmark.cpp @@ -56,7 +56,7 @@ void Newmark::start(MshExport *mshWriter) // setup results Results results; results.scalars_at_nodes["u"] = &u1; - //results.scalars_at_nodes["v"] = &v1; + // results.scalars_at_nodes["v"] = &v1; // time integration @@ -90,10 +90,10 @@ void Newmark::start(MshExport *mshWriter) if (nt % savefreq == 0) { - //std::cout << "nt " << nt << " t=" << t << "\n"; + // std::cout << "nt " << nt << " t=" << t << "\n"; results.time = t; results.nt++; - //mshWriter->save("res", results); + // mshWriter->save("res", results); if (dhook) dhook->display(nt, t, u1); diff --git a/waves/src/wNewmark.h b/waves/src/wNewmark.h index b03d580..28f0e02 100644 --- a/waves/src/wNewmark.h +++ b/waves/src/wNewmark.h @@ -42,4 +42,4 @@ public: } // namespace waves -#endif //WNEWMARK_H +#endif // WNEWMARK_H diff --git a/waves/src/wProblem.h b/waves/src/wProblem.h index adff43b..248d7ab 100644 --- a/waves/src/wProblem.h +++ b/waves/src/wProblem.h @@ -55,4 +55,4 @@ public: }; } // namespace waves -#endif //WPROBLEM_H +#endif // WPROBLEM_H diff --git a/waves/src/wRungeKutta.cpp b/waves/src/wRungeKutta.cpp index 75e9baf..4b8689d 100644 --- a/waves/src/wRungeKutta.cpp +++ b/waves/src/wRungeKutta.cpp @@ -52,7 +52,7 @@ void RungeKutta::start(MshExport *mshWriter) // setup results Results results; results.scalars_at_nodes["u"] = &u1; - //results.scalars_at_nodes["v"] = &v1; + // results.scalars_at_nodes["v"] = &v1; // time integration @@ -75,15 +75,16 @@ void RungeKutta::start(MshExport *mshWriter) std::vector<double> u2(msh->nodes.size()); std::vector<double> v2(msh->nodes.size()); - //Node *snod = msh->ntags["Source Point"]->elems[0]->nodes[0]; + // Node *snod = msh->ntags["Source Point"]->elems[0]->nodes[0]; while (t < ttot) { std::cout << "nt " << nt << " t=" << t << "\n"; - //u1[snod->row] = sin(2*M_PI*20*t); // BC - //if(source) source->apply(t, u1); - std::for_each(pbl->srcs.begin(), pbl->srcs.end(), [&](std::shared_ptr<Source> s) { s->apply(t, u1); }); + // u1[snod->row] = sin(2*M_PI*20*t); // BC + // if(source) source->apply(t, u1); + std::for_each(pbl->srcs.begin(), pbl->srcs.end(), [&](std::shared_ptr<Source> s) + { s->apply(t, u1); }); t += dt; nt++; @@ -97,16 +98,17 @@ void RungeKutta::start(MshExport *mshWriter) predictor(u2, v2, up2, vp2, u1, v1, dt, Md, K, S, 1. / 8., t); predictor(u1, v1, up3, vp3, u2, v2, dt, Md, K, S, 1. / 24., t); - //u1[snod->row] = sin(2*M_PI*20*t); //BC bis - //if(source) source->apply(t, u1); - std::for_each(pbl->srcs.begin(), pbl->srcs.end(), [&](std::shared_ptr<Source> s) { s->apply(t, u1); }); + // u1[snod->row] = sin(2*M_PI*20*t); //BC bis + // if(source) source->apply(t, u1); + std::for_each(pbl->srcs.begin(), pbl->srcs.end(), [&](std::shared_ptr<Source> s) + { s->apply(t, u1); }); if (nt % savefreq == 0) { - //std::cout << "nt " << nt << " t=" << t << "\n"; + // std::cout << "nt " << nt << " t=" << t << "\n"; results.time = t; results.nt++; - //mshWriter->save("res", results); + // mshWriter->save("res", results); if (dhook) dhook->display(nt, t, u1); @@ -132,10 +134,11 @@ void RungeKutta::predictor(std::vector<double> &up2, std::vector<double> &vp2, / // equation #1 up2_ = u0_ + vp1_ * ak * dt; - //up2[snod->row] = sin(2*M_PI*20*t); //BC bis - //if(source) source->apply(t, up2); + // up2[snod->row] = sin(2*M_PI*20*t); //BC bis + // if(source) source->apply(t, up2); - std::for_each(pbl->srcs.begin(), pbl->srcs.end(), [&](std::shared_ptr<Source> s) { s->apply(t, up2); }); + std::for_each(pbl->srcs.begin(), pbl->srcs.end(), [&](std::shared_ptr<Source> s) + { s->apply(t, up2); }); // equation #2 vp2_.array() = v0_.array() - ak * dt * (K * up1_ + S * vp1_).array() / Md_.array(); diff --git a/waves/src/wRungeKutta.h b/waves/src/wRungeKutta.h index e79690f..61183b1 100644 --- a/waves/src/wRungeKutta.h +++ b/waves/src/wRungeKutta.h @@ -51,4 +51,4 @@ private: } // namespace waves -#endif //WRUNGEKUTTA_H +#endif // WRUNGEKUTTA_H diff --git a/waves/src/wSource.cpp b/waves/src/wSource.cpp index 595eea5..3b9952f 100644 --- a/waves/src/wSource.cpp +++ b/waves/src/wSource.cpp @@ -28,13 +28,13 @@ Source::Source(std::shared_ptr<MshData> _msh, int no) : Group(_msh, no) for (auto n : e->nodes) nodes.push_back(n); /* - std::for_each(tag->elems.begin(), tag->elems.end(), [&](Element *e) { - std::for_each(e->nodes.begin(), e->nodes.end(), [&](Node *n) { - nodes.push_back(n); + std::for_each(tag->elems.begin(), tag->elems.end(), [&](Element *e) { + std::for_each(e->nodes.begin(), e->nodes.end(), [&](Node *n) { + nodes.push_back(n); }); }); */ - //pbl.srcs.push_back(this); + // pbl.srcs.push_back(this); } Source::Source(std::shared_ptr<MshData> _msh, std::string const &name) : Group(_msh, name) @@ -43,13 +43,13 @@ Source::Source(std::shared_ptr<MshData> _msh, std::string const &name) : Group(_ for (auto n : e->nodes) nodes.push_back(n); - //pbl.srcs.push_back(this); + // pbl.srcs.push_back(this); } void Source::write(std::ostream &out) const { out << "Source on " << *tag; out << "(" << nodes.size() << " nodes)"; - //std::for_each(nodes.begin(), nodes.end(), [&](Node *n) { out << '\t' << *n << '\n'; }); - //for(auto n : nodes) { out << '\t' << *n << '\n'; } + // std::for_each(nodes.begin(), nodes.end(), [&](Node *n) { out << '\t' << *n << '\n'; }); + // for(auto n : nodes) { out << '\t' << *n << '\n'; } } diff --git a/waves/src/wSource.h b/waves/src/wSource.h index 6ed5465..2884b4a 100644 --- a/waves/src/wSource.h +++ b/waves/src/wSource.h @@ -47,4 +47,4 @@ public: }; } // namespace waves -#endif //WSOURCE_H +#endif // WSOURCE_H diff --git a/waves/src/wTimeIntegration.cpp b/waves/src/wTimeIntegration.cpp index 7f13762..074f7bd 100644 --- a/waves/src/wTimeIntegration.cpp +++ b/waves/src/wTimeIntegration.cpp @@ -102,7 +102,8 @@ void TimeIntegration::buildS(Eigen::SparseMatrix<double, Eigen::RowMajor> &S2) { std::cout << "\tprocessing " << *bnd << '\n'; std::cout << "normal=" << static_cast<Quad4 *>(bnd->tag->elems[0])->getNormal() << '\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::QUAD4) return; //std::cout << "processing element #" << e->no << "\n"; @@ -121,8 +122,7 @@ void TimeIntegration::buildS(Eigen::SparseMatrix<double, Eigen::RowMajor> &S2) Node *nodj = e->nodes[jj]; T.push_back(Eigen::Triplet<double>(nodi->row, nodj->row, bnd->c * Se(ii, jj))); } - } - }); + } }); } // Build, clean and turn to compressed row format S2.setFromTriplets(T.begin(), T.end()); @@ -158,7 +158,8 @@ void TimeIntegration::buildKM_tbb_lambda(Eigen::SparseMatrix<double, Eigen::RowM for (auto mat : pbl->media) { 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::HEX8) return; //std::cout << "processing element #" << e->no << "\n"; @@ -181,8 +182,7 @@ void TimeIntegration::buildKM_tbb_lambda(Eigen::SparseMatrix<double, Eigen::RowM T.push_back(Eigen::Triplet<double>(nodi->row, nodj->row, (mat->c * mat->c) * Ke(ii, jj))); Md[nodi->row] += Me(ii, jj); } - } - }); + } }); } // Build, clean and turn to compressed row format K2.setFromTriplets(T.begin(), T.end()); diff --git a/waves/src/wTimeIntegration.h b/waves/src/wTimeIntegration.h index b47326b..9a1c282 100644 --- a/waves/src/wTimeIntegration.h +++ b/waves/src/wTimeIntegration.h @@ -78,7 +78,7 @@ public: void setGUI(DisplayHook &hook) { dhook = &hook; } - //void build(tbox::MATTYPE type, Eigen::SparseMatrix<double, Eigen::RowMajor> &A2); + // void build(tbox::MATTYPE type, Eigen::SparseMatrix<double, Eigen::RowMajor> &A2); void stop() { stopit = true; } @@ -89,4 +89,4 @@ public: } // namespace waves -#endif //WTIMEINTEGRATION_H +#endif // WTIMEINTEGRATION_H diff --git a/waves/src/wWaveTerm.h b/waves/src/wWaveTerm.h index 6ad3a38..4fa15e3 100644 --- a/waves/src/wWaveTerm.h +++ b/waves/src/wWaveTerm.h @@ -38,4 +38,4 @@ public: }; } // namespace waves -#endif //WWAVETERM_H +#endif // WWAVETERM_H diff --git a/waves/src/waves.h b/waves/src/waves.h index 46f05cc..b9839f2 100644 --- a/waves/src/waves.h +++ b/waves/src/waves.h @@ -48,4 +48,4 @@ class RungeKutta; class Newmark; } // namespace waves -#endif //WAVES_H +#endif // WAVES_H -- GitLab