Изменение индексов граничных условий

Оптимизация кода
This commit is contained in:
2025-05-15 23:26:58 +03:00
parent 5d555820cc
commit 3ed8093481
6 changed files with 14 additions and 57 deletions

View File

@@ -1,9 +1,11 @@
#ifndef MIMAPR_MESH_H
#define MIMAPR_MESH_H
#include <vector>
#include "Object.hpp"
#include "Node.hpp"
#include <vector>
#include <iostream>
#include <fstream>
class Mesh{
std::vector<std::vector<Node*>> mesh;

View File

@@ -1,6 +1,8 @@
#ifndef MIMAPR_NODE_H
#define MIMAPR_NODE_H
#define T_START 0.
#include <cmath>
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;

View File

@@ -37,7 +37,3 @@ bool Form::Excluded() const {
}
int Form::GetB() { return bound_type; }
//bool Form::operator==(size_t id) const {
// return id_ == id;
//}

View File

@@ -1,8 +1,4 @@
#include "Mesh.hpp"
#include <iostream>
#include <fstream>
#include <Object.hpp>
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<Node*>());
@@ -148,33 +144,3 @@ Mesh::~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';
// }
//}

View File

@@ -72,15 +72,6 @@ double Object::Height() const {
return h;
}
//std::vector<size_t> Object::Get_IDs() {
// std::vector<size_t> 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)) {

View File

@@ -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;