Изменение индексов граничных условий
Оптимизация кода
This commit is contained in:
@@ -1,9 +1,11 @@
|
|||||||
#ifndef MIMAPR_MESH_H
|
#ifndef MIMAPR_MESH_H
|
||||||
#define MIMAPR_MESH_H
|
#define MIMAPR_MESH_H
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
#include "Object.hpp"
|
#include "Object.hpp"
|
||||||
#include "Node.hpp"
|
#include "Node.hpp"
|
||||||
|
#include <vector>
|
||||||
|
#include <iostream>
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
class Mesh{
|
class Mesh{
|
||||||
std::vector<std::vector<Node*>> mesh;
|
std::vector<std::vector<Node*>> mesh;
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
#ifndef MIMAPR_NODE_H
|
#ifndef MIMAPR_NODE_H
|
||||||
#define MIMAPR_NODE_H
|
#define MIMAPR_NODE_H
|
||||||
|
|
||||||
|
#define T_START 0.
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
class Node{
|
class Node{
|
||||||
@@ -14,7 +16,7 @@ class Node{
|
|||||||
Node* above;
|
Node* above;
|
||||||
Node* bellow;
|
Node* bellow;
|
||||||
public:
|
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 T() const;
|
||||||
double X() const;
|
double X() const;
|
||||||
|
|||||||
@@ -36,8 +36,4 @@ bool Form::Excluded() const {
|
|||||||
return excluded;
|
return excluded;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Form::GetB() { return bound_type; }
|
int Form::GetB() { return bound_type; }
|
||||||
|
|
||||||
//bool Form::operator==(size_t id) const {
|
|
||||||
// return id_ == id;
|
|
||||||
//}
|
|
||||||
36
src/Mesh.cpp
36
src/Mesh.cpp
@@ -1,8 +1,4 @@
|
|||||||
#include "Mesh.hpp"
|
#include "Mesh.hpp"
|
||||||
#include <iostream>
|
|
||||||
#include <fstream>
|
|
||||||
#include <Object.hpp>
|
|
||||||
|
|
||||||
Mesh::Mesh(Object& _obj, double _step) : obj(_obj), step(_step) {
|
Mesh::Mesh(Object& _obj, double _step) : obj(_obj), step(_step) {
|
||||||
for (double y = 0.0; y <= _obj.Height(); y += _step) {
|
for (double y = 0.0; y <= _obj.Height(); y += _step) {
|
||||||
mesh.push_back(std::vector<Node*>());
|
mesh.push_back(std::vector<Node*>());
|
||||||
@@ -147,34 +143,4 @@ Mesh::~Mesh() {
|
|||||||
for (auto line : mesh)
|
for (auto line : mesh)
|
||||||
for (auto node : line)
|
for (auto node : line)
|
||||||
delete node;
|
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';
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
@@ -72,15 +72,6 @@ double Object::Height() const {
|
|||||||
return h;
|
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) {
|
Form* Object::Who(double x, double y) {
|
||||||
for (auto form : forms) {
|
for (auto form : forms) {
|
||||||
if (form->Inhere(x, y)) {
|
if (form->Inhere(x, y)) {
|
||||||
|
|||||||
12
src/main.cpp
12
src/main.cpp
@@ -32,15 +32,15 @@ int main()
|
|||||||
{
|
{
|
||||||
/* Граничные условия:
|
/* Граничные условия:
|
||||||
1 - нагрев
|
1 - нагрев
|
||||||
2 - теплоизоляция
|
2 - конвекция
|
||||||
3 - конвекция
|
3 - теплоизоляция
|
||||||
4 - отсутствует
|
0 - отсутствует
|
||||||
*/
|
*/
|
||||||
int left = 1;
|
int left = 1;
|
||||||
int top = 3;
|
int top = 2;
|
||||||
int right = 1;
|
int right = 1;
|
||||||
int bottom = 3;
|
int bottom = 2;
|
||||||
int arc_bound = 3;
|
int arc_bound = 2;
|
||||||
int hole_bound = 1;
|
int hole_bound = 1;
|
||||||
|
|
||||||
double step_5 = 5;
|
double step_5 = 5;
|
||||||
|
|||||||
Reference in New Issue
Block a user