From d4b9adaf34e258e6abe80445401c83e3307f24bc Mon Sep 17 00:00:00 2001 From: Paul Dechamps <paul.dechamps@uliege.be> Date: Sun, 26 Jan 2025 18:39:46 +0100 Subject: [PATCH] (refactor) Added reference to setters in BoundaryLayer --- blast/src/DBoundaryLayer.cpp | 12 ++++++------ blast/src/DBoundaryLayer.h | 36 +++++++++++++----------------------- 2 files changed, 19 insertions(+), 29 deletions(-) diff --git a/blast/src/DBoundaryLayer.cpp b/blast/src/DBoundaryLayer.cpp index f93d1b3..d61d8c6 100644 --- a/blast/src/DBoundaryLayer.cpp +++ b/blast/src/DBoundaryLayer.cpp @@ -22,10 +22,10 @@ BoundaryLayer::BoundaryLayer(double _xtrF, std::string _name) BoundaryLayer::~BoundaryLayer() { delete closSolver; } -void BoundaryLayer::setMesh(std::vector<double> _x, std::vector<double> _y, - std::vector<double> _z, double _chord, double _xMin, - std::vector<int> const _rows, - std::vector<int> const _no) +void BoundaryLayer::setMesh(const std::vector<double> &_x, const std::vector<double> &_y, + const std::vector<double> &_z, const double &_chord, + const double &_xMin, const std::vector<int> &_rows, + const std::vector<int> &_no) { if (_x.size() != _y.size() || _x.size() != _z.size()) throw std::runtime_error("Mesh coordinates are not consistent."); @@ -166,8 +166,8 @@ void BoundaryLayer::setStagnationBC(double Re) * @param UpperCond Variables at the last point on the upper side. * @param LowerCond Variables at the last point on the lower side. */ -void BoundaryLayer::setWakeBC(double Re, std::vector<double> UpperCond, - std::vector<double> LowerCond) +void BoundaryLayer::setWakeBC(double Re, std::vector<double> &UpperCond, + std::vector<double> &LowerCond) { if (name != "wake") std::cout << "Warning: Imposing wake boundary condition on " << name diff --git a/blast/src/DBoundaryLayer.h b/blast/src/DBoundaryLayer.h index a4be620..f8046be 100644 --- a/blast/src/DBoundaryLayer.h +++ b/blast/src/DBoundaryLayer.h @@ -88,72 +88,62 @@ public: size_t getnNodes() const { return nNodes; }; size_t getnElms() const { return nElms; }; - std::vector<double> getDeltaStar() const { return deltaStar; }; - std::vector<double> getUe() const - { - std::vector<double> ue(nNodes, 0.); - for (size_t i = 0; i < nNodes; ++i) - ue[i] = u[i * nVar + 3]; - return ue; - }; - std::vector<double> getBlowing() const { return blowingVelocity; }; double getMaxMach() const { return *std::max_element(Me.begin(), Me.end()); }; // Setters - void setMesh(std::vector<double> const _x, std::vector<double> const y, - std::vector<double> const z, double const _chord, - double const _xMin, - std::vector<int> const _rows = std::vector<int>(0), - std::vector<int> const _no = std::vector<int>(0)); + void setMesh(const std::vector<double> &_x, const std::vector<double> &y, + const std::vector<double> &z, const double &_chord, + const double &_xMin, const std::vector<int> &_rows = std::vector<int>(0), + const std::vector<int> &_no = std::vector<int>(0)); void computeLocalCoordinates(); - void setMe(std::vector<double> const _Me) + void setMe(std::vector<double> const &_Me) { if (_Me.size() != nNodes) throw std::runtime_error("Mach number vector is not consistent."); Me = _Me; }; - void setVt(std::vector<double> const _vt) + void setVt(std::vector<double> const &_vt) { if (_vt.size() != nNodes) throw std::runtime_error("Velocity vector is not consistent."); vt = _vt; }; - void setRhoe(std::vector<double> const _rhoe) + void setRhoe(std::vector<double> const &_rhoe) { if (_rhoe.size() != nNodes) throw std::runtime_error("Density vector is not consistent."); rhoe = _rhoe; }; - void setxxExt(std::vector<double> const _xxExt) + void setxxExt(std::vector<double> const &_xxExt) { if (_xxExt.size() != nNodes) throw std::runtime_error("External mesh vector is not consistent."); xxExt = _xxExt; }; - void setDeltaStarExt(std::vector<double> const _deltaStarExt) + void setDeltaStarExt(std::vector<double> const &_deltaStarExt) { if (_deltaStarExt.size() != nNodes) throw std::runtime_error( "Displacement thickness vector is not consistent."); deltaStarExt = _deltaStarExt; }; - void setVtExt(std::vector<double> const _vtExt) + void setVtExt(std::vector<double> const &_vtExt) { if (_vtExt.size() != nNodes) throw std::runtime_error("Velocity vector is not consistent."); vtExt = _vtExt; }; void setxtrF(double const _xtrF) { xtrF = _xtrF; }; + void setnCrit(double const _nCrit) { nCrit = _nCrit; }; // Boundary conditions. void setStagnationBC(double Re); - void setWakeBC(double Re, std::vector<double> upperConditions, - std::vector<double> lowerConditions); + void setWakeBC(double Re, std::vector<double> &upperConditions, + std::vector<double> &lowerConditions); // Getters. size_t getnVar() const { return nVar; }; double getnCrit() const { return nCrit; }; - void setnCrit(double const _nCrit) { nCrit = _nCrit; }; // Others void printSolution(size_t iPoint) const; -- GitLab