From 3ed80934811e2dab2808c289b3126e6ae5db14eb Mon Sep 17 00:00:00 2001 From: ParkSuMin Date: Thu, 15 May 2025 23:26:58 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=B8=D0=BD=D0=B4=D0=B5=D0=BA=D1=81=D0=BE=D0=B2?= =?UTF-8?q?=20=D0=B3=D1=80=D0=B0=D0=BD=D0=B8=D1=87=D0=BD=D1=8B=D1=85=20?= =?UTF-8?q?=D1=83=D1=81=D0=BB=D0=BE=D0=B2=D0=B8=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Оптимизация кода --- include/Mesh.hpp | 4 +++- include/Node.hpp | 4 +++- src/Form.cpp | 6 +----- src/Mesh.cpp | 36 +----------------------------------- src/Object.cpp | 9 --------- src/main.cpp | 12 ++++++------ 6 files changed, 14 insertions(+), 57 deletions(-) diff --git a/include/Mesh.hpp b/include/Mesh.hpp index 318c856..3b607ee 100644 --- a/include/Mesh.hpp +++ b/include/Mesh.hpp @@ -1,9 +1,11 @@ #ifndef MIMAPR_MESH_H #define MIMAPR_MESH_H -#include #include "Object.hpp" #include "Node.hpp" +#include +#include +#include class Mesh{ std::vector> mesh; diff --git a/include/Node.hpp b/include/Node.hpp index 232deea..e67811e 100644 --- a/include/Node.hpp +++ b/include/Node.hpp @@ -1,6 +1,8 @@ #ifndef MIMAPR_NODE_H #define MIMAPR_NODE_H +#define T_START 0. + #include class Node{ @@ -14,7 +16,7 @@ class Node{ Node* above; Node* bellow; public: - Node(double _x = 0., double _y = 0., int _type = 0., double _t = 0.): x(_x), y(_y), t(_t), left(nullptr), right(nullptr), above(nullptr), bellow(nullptr), btype(_type) {} + Node(double _x = 0., double _y = 0., int _type = 0., double _t = T_START): x(_x), y(_y), t(_t), left(nullptr), right(nullptr), above(nullptr), bellow(nullptr), btype(_type) {} double T() const; double X() const; diff --git a/src/Form.cpp b/src/Form.cpp index e8f8c8e..59ca39f 100644 --- a/src/Form.cpp +++ b/src/Form.cpp @@ -36,8 +36,4 @@ bool Form::Excluded() const { return excluded; } -int Form::GetB() { return bound_type; } - -//bool Form::operator==(size_t id) const { -// return id_ == id; -//} \ No newline at end of file +int Form::GetB() { return bound_type; } \ No newline at end of file diff --git a/src/Mesh.cpp b/src/Mesh.cpp index d7cca27..f7544a0 100644 --- a/src/Mesh.cpp +++ b/src/Mesh.cpp @@ -1,8 +1,4 @@ #include "Mesh.hpp" -#include -#include -#include - Mesh::Mesh(Object& _obj, double _step) : obj(_obj), step(_step) { for (double y = 0.0; y <= _obj.Height(); y += _step) { mesh.push_back(std::vector()); @@ -147,34 +143,4 @@ Mesh::~Mesh() { for (auto line : mesh) for (auto node : line) delete node; -} - -//void Mesh::ShowLinks() { - // for (auto line : mesh) { - // for (auto node : line) { - // if (node->d()) - // std::cout << "| "; - // } - // std::cout << '\n'; - // for (auto node : line) { - // if (node->l()) { - // std::cout << '-'; - // } - // std::cout << 'N'; - // if (node->r()) { - // std::cout << '-'; - // } - // else { - // std::cout << '\n'; - // } - // } - // for (auto node : line) { - // if (node->u()) - // std::cout << "|"; - // std::cout << " "; - // - // } - // std::cout << '\n'; - // } - //} - +} \ No newline at end of file diff --git a/src/Object.cpp b/src/Object.cpp index 1d870b6..850f66a 100644 --- a/src/Object.cpp +++ b/src/Object.cpp @@ -72,15 +72,6 @@ double Object::Height() const { return h; } -//std::vector Object::Get_IDs() { -// std::vector ids; -// ids.reserve(forms.size()); -// for (auto form : forms) { -// ids.push_back(form->Get_ID()); -// } -// return ids; -//} - Form* Object::Who(double x, double y) { for (auto form : forms) { if (form->Inhere(x, y)) { diff --git a/src/main.cpp b/src/main.cpp index 3aff39c..19d3fe2 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -32,15 +32,15 @@ int main() { /* Граничные условия: 1 - нагрев - 2 - теплоизоляция - 3 - конвекция - 4 - отсутствует + 2 - конвекция + 3 - теплоизоляция + 0 - отсутствует */ int left = 1; - int top = 3; + int top = 2; int right = 1; - int bottom = 3; - int arc_bound = 3; + int bottom = 2; + int arc_bound = 2; int hole_bound = 1; double step_5 = 5;