Compare commits
3 Commits
2f34e82bab
...
test
| Author | SHA1 | Date | |
|---|---|---|---|
| 5d7a521945 | |||
| 5d1f889a1b | |||
| 2b58527857 |
@@ -3,9 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
|||||||
# Visual Studio Version 17
|
# Visual Studio Version 17
|
||||||
VisualStudioVersion = 17.12.35707.178
|
VisualStudioVersion = 17.12.35707.178
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Main_program", "MemMAPR_winda.vcxproj", "{86DC468D-3A9F-48AB-80FC-059A120499AA}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MemMAPR_main", "MemMAPR_winda.vcxproj", "{86DC468D-3A9F-48AB-80FC-059A120499AA}"
|
||||||
EndProject
|
|
||||||
Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "MemMAPR_visual", "..\MemMAPR_visual\MemMAPR_visual.pyproj", "{C56779D9-6429-49A0-8E09-0AE6A666EA21}"
|
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@@ -29,12 +27,6 @@ Global
|
|||||||
{86DC468D-3A9F-48AB-80FC-059A120499AA}.Release|x64.Build.0 = Release|x64
|
{86DC468D-3A9F-48AB-80FC-059A120499AA}.Release|x64.Build.0 = Release|x64
|
||||||
{86DC468D-3A9F-48AB-80FC-059A120499AA}.Release|x86.ActiveCfg = Release|Win32
|
{86DC468D-3A9F-48AB-80FC-059A120499AA}.Release|x86.ActiveCfg = Release|Win32
|
||||||
{86DC468D-3A9F-48AB-80FC-059A120499AA}.Release|x86.Build.0 = Release|Win32
|
{86DC468D-3A9F-48AB-80FC-059A120499AA}.Release|x86.Build.0 = Release|Win32
|
||||||
{C56779D9-6429-49A0-8E09-0AE6A666EA21}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{C56779D9-6429-49A0-8E09-0AE6A666EA21}.Debug|x64.ActiveCfg = Debug|Any CPU
|
|
||||||
{C56779D9-6429-49A0-8E09-0AE6A666EA21}.Debug|x86.ActiveCfg = Debug|Any CPU
|
|
||||||
{C56779D9-6429-49A0-8E09-0AE6A666EA21}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{C56779D9-6429-49A0-8E09-0AE6A666EA21}.Release|x64.ActiveCfg = Release|Any CPU
|
|
||||||
{C56779D9-6429-49A0-8E09-0AE6A666EA21}.Release|x86.ActiveCfg = Release|Any CPU
|
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
10
es10.plt
10
es10.plt
@@ -1,10 +0,0 @@
|
|||||||
set cbrange [0:100]
|
|
||||||
set size ratio 0.8
|
|
||||||
unset key
|
|
||||||
|
|
||||||
set palette defined (0 0 0 1, 0.25 0 1 1, 0.5 0 1 0, 0.75 1 1 0, 1 1 0 0)
|
|
||||||
|
|
||||||
do for [i=0:99]{
|
|
||||||
plot 'explicit10.txt' u 1:2:3 index i w points pt 5 palette
|
|
||||||
pause 1e-09}
|
|
||||||
pause mouse
|
|
||||||
10
es5.plt
10
es5.plt
@@ -1,10 +0,0 @@
|
|||||||
set cbrange [0:100]
|
|
||||||
set size ratio 0.8
|
|
||||||
unset key
|
|
||||||
|
|
||||||
set palette defined (0 0 0 1, 0.25 0 1 1, 0.5 0 1 0, 0.75 1 1 0, 1 1 0 0)
|
|
||||||
|
|
||||||
do for [i=0:99]{
|
|
||||||
plot 'explicit5.txt' u 1:2:3 index i w points pt 5 palette
|
|
||||||
pause 1e-09}
|
|
||||||
pause mouse
|
|
||||||
@@ -20,7 +20,7 @@ public:
|
|||||||
double X() const;
|
double X() const;
|
||||||
double Y() const;
|
double Y() const;
|
||||||
|
|
||||||
//double Dist(const Node*) const;
|
double Dist(const Node*) const;
|
||||||
void LinkX(Node*, Node*);
|
void LinkX(Node*, Node*);
|
||||||
void LinkY(Node*, Node*);
|
void LinkY(Node*, Node*);
|
||||||
Node*& l();
|
Node*& l();
|
||||||
@@ -30,8 +30,6 @@ public:
|
|||||||
void SetT(double);
|
void SetT(double);
|
||||||
bool IsBound();
|
bool IsBound();
|
||||||
void SetB(int);
|
void SetB(int);
|
||||||
|
|
||||||
double operator-(const Node*) const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
10
is10.plt
10
is10.plt
@@ -1,10 +0,0 @@
|
|||||||
set cbrange [0:100]
|
|
||||||
set size ratio 0.8
|
|
||||||
unset key
|
|
||||||
|
|
||||||
set palette defined (0 0 0 1, 0.25 0 1 1, 0.5 0 1 0, 0.75 1 1 0, 1 1 0 0)
|
|
||||||
|
|
||||||
do for [i=0:99]{
|
|
||||||
plot 'implicit10.txt' u 1:2:3 index i w points pt 5 palette
|
|
||||||
pause 1e-09}
|
|
||||||
pause mouse
|
|
||||||
10
is5.plt
10
is5.plt
@@ -1,10 +0,0 @@
|
|||||||
set cbrange [0:100]
|
|
||||||
set size ratio 0.8
|
|
||||||
unset key
|
|
||||||
|
|
||||||
set palette defined (0 0 0 1, 0.25 0 1 1, 0.5 0 1 0, 0.75 1 1 0, 1 1 0 0)
|
|
||||||
|
|
||||||
do for [i=0:99]{
|
|
||||||
plot 'implicit5.txt' u 1:2:3 index i w points pt 5 palette
|
|
||||||
pause 1e-09}
|
|
||||||
pause mouse
|
|
||||||
23
src/Node.cpp
23
src/Node.cpp
@@ -34,39 +34,35 @@ double Node::T() const {
|
|||||||
if (_btype == 3) {
|
if (_btype == 3) {
|
||||||
if (!_left)
|
if (!_left)
|
||||||
if (_right)
|
if (_right)
|
||||||
return _right->T() / (1 + this - _right);
|
return _right->T() / (1 + Dist(_right));
|
||||||
if (!_right)
|
if (!_right)
|
||||||
if (_left)
|
if (_left)
|
||||||
return _left->T() / (1 + this - _left);
|
return _left->T() / (1 + Dist(_left));
|
||||||
if (!_above)
|
if (!_above)
|
||||||
if (_below)
|
if (_below)
|
||||||
return _below->T() / (1 + this - _below);
|
return _below->T() / (1 + Dist(_below));
|
||||||
if (!_below)
|
if (!_below)
|
||||||
if (_above)
|
if (_above)
|
||||||
return _above->T() / (1 + this - _above);
|
return _above->T() / (1 + Dist(_above));
|
||||||
if (_right && _left) {
|
if (_right && _left) {
|
||||||
if (_right->IsBound())
|
if (_right->IsBound())
|
||||||
return _left->T() / (1 + this - _left);
|
return _left->T() / (1 + Dist(_left));
|
||||||
return _right->T() / (1 + this - _right);
|
return _right->T() / (1 + Dist(_right));
|
||||||
}
|
}
|
||||||
if (_above && _below) {
|
if (_above && _below) {
|
||||||
if (_above->IsBound())
|
if (_above->IsBound())
|
||||||
return _below->T() / (1 + this - _below);
|
return _below->T() / (1 + Dist(_below));
|
||||||
return _above->T() / (1 + this - _above);
|
return _above->T() / (1 + Dist(_above));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return _t;
|
return _t;
|
||||||
}
|
}
|
||||||
|
|
||||||
double Node::operator-(const Node* to) const {
|
double Node::Dist(const Node* to) const {
|
||||||
return std::sqrt(pow(X() - to->X(), 2) + pow(Y() - to->Y(), 2));
|
return std::sqrt(pow(X() - to->X(), 2) + pow(Y() - to->Y(), 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
//double Node::Dist(const Node* to) const {
|
|
||||||
// return std::sqrt(pow(X() - to->X(), 2) + pow(Y() - to->Y(), 2));
|
|
||||||
//}
|
|
||||||
|
|
||||||
Node*& Node::l() { return _left; }
|
Node*& Node::l() { return _left; }
|
||||||
Node*& Node::r() { return _right; }
|
Node*& Node::r() { return _right; }
|
||||||
Node*& Node::u() { return _above; }
|
Node*& Node::u() { return _above; }
|
||||||
@@ -88,4 +84,3 @@ void Node::SetT(double t) {
|
|||||||
|
|
||||||
bool Node::IsBound() { return _btype; }
|
bool Node::IsBound() { return _btype; }
|
||||||
void Node::SetB(int type) { _btype = type; }
|
void Node::SetB(int type) { _btype = type; }
|
||||||
|
|
||||||
|
|||||||
@@ -80,8 +80,8 @@ void Solver::SolveImplicit(System& sys, double tstop) const {
|
|||||||
|
|
||||||
void Solver::SolveLine(System& sys, std::vector<Node*>& n) const {
|
void Solver::SolveLine(System& sys, std::vector<Node*>& n) const {
|
||||||
int size = n.size() - 2;
|
int size = n.size() - 2;
|
||||||
double mu1 = (n.front() - n[1]) / sys.step();
|
double mu1 = n.front()->Dist(n[1]) / sys.step();
|
||||||
double mu2 = (n.back() - n[n.size() - 2]) / sys.step();
|
double mu2 = n.back()->Dist(n[n.size() - 2]) / sys.step();
|
||||||
/* Защита от нуля */
|
/* Защита от нуля */
|
||||||
if (mu2 == 0.)
|
if (mu2 == 0.)
|
||||||
mu2 = .1;
|
mu2 = .1;
|
||||||
|
|||||||
27
src/main.cpp
27
src/main.cpp
@@ -2,6 +2,8 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <Solver.hpp>
|
#include <Solver.hpp>
|
||||||
|
|
||||||
|
#define STEP 1
|
||||||
|
|
||||||
#define WIDTH 500.
|
#define WIDTH 500.
|
||||||
#define HEIGHT 400.
|
#define HEIGHT 400.
|
||||||
|
|
||||||
@@ -11,8 +13,8 @@
|
|||||||
//#define SQUARE_Y 155.
|
//#define SQUARE_Y 155.
|
||||||
//#define SQUARE_SIDE 100.
|
//#define SQUARE_SIDE 100.
|
||||||
|
|
||||||
#define HOLE_X 355.
|
#define HOLE_X 155.
|
||||||
#define HOLE_Y 155.
|
#define HOLE_Y 255.
|
||||||
#define HOLE_RADIUS 50.
|
#define HOLE_RADIUS 50.
|
||||||
|
|
||||||
#define CONDUCTIVITY 50. // Теплопроводность материала
|
#define CONDUCTIVITY 50. // Теплопроводность материала
|
||||||
@@ -38,13 +40,12 @@ int main()
|
|||||||
int top = 1;
|
int top = 1;
|
||||||
int right = 3;
|
int right = 3;
|
||||||
int bottom = 1;
|
int bottom = 1;
|
||||||
int r2 = 3;
|
int arc_bound = 3;
|
||||||
int s = 3;
|
int hole_bound = 1;
|
||||||
|
|
||||||
double step_5 = 5;
|
double step_5 = 5;
|
||||||
double step_10 = 10;
|
double step_10 = 10;
|
||||||
|
|
||||||
double time_step = 1;
|
|
||||||
double time_end = 100;
|
double time_end = 100;
|
||||||
|
|
||||||
std::map<std::string, double> plate{
|
std::map<std::string, double> plate{
|
||||||
@@ -58,8 +59,8 @@ int main()
|
|||||||
};
|
};
|
||||||
|
|
||||||
Object obj;
|
Object obj;
|
||||||
obj.Add_Form("Circle", circle, true, s);
|
obj.Add_Form("Circle", circle, true, hole_bound);
|
||||||
obj.Add_Form("Arc", arc, true, r2);
|
obj.Add_Form("Arc", arc, true, arc_bound);
|
||||||
obj.Add_Form("Rectangle", plate, false, 1);
|
obj.Add_Form("Rectangle", plate, false, 1);
|
||||||
|
|
||||||
System explicit5(obj, step_5, CONDUCTIVITY);
|
System explicit5(obj, step_5, CONDUCTIVITY);
|
||||||
@@ -74,27 +75,27 @@ int main()
|
|||||||
implicit5.DefineBounds(left, top, right, bottom);
|
implicit5.DefineBounds(left, top, right, bottom);
|
||||||
implicit10.DefineBounds(left, top, right, bottom);
|
implicit10.DefineBounds(left, top, right, bottom);
|
||||||
|
|
||||||
Solver slv5("explicit5.txt", "implicit5.txt", time_step);
|
Solver slv5("explicit5.txt", "implicit5.txt", STEP);
|
||||||
Solver slv10("explicit10.txt", "implicit10.txt", time_step);
|
Solver slv10("explicit10.txt", "implicit10.txt", STEP);
|
||||||
|
|
||||||
slv5.SolveExplicit(explicit5, time_end);
|
slv5.SolveExplicit(explicit5, time_end);
|
||||||
slv5.SolveImplicit(implicit5, time_end);
|
slv5.SolveImplicit(implicit5, time_end);
|
||||||
slv10.SolveExplicit(explicit10, time_end);
|
slv10.SolveExplicit(explicit10, time_end);
|
||||||
slv10.SolveImplicit(implicit10, time_end);
|
slv10.SolveImplicit(implicit10, time_end);
|
||||||
|
|
||||||
std::ofstream script("es10.plt");
|
std::ofstream script("ixplicit10.plt");
|
||||||
visualize(script, "explicit10.txt", time_end);
|
visualize(script, "explicit10.txt", time_end);
|
||||||
script.close();
|
script.close();
|
||||||
|
|
||||||
script.open("is10.plt");
|
script.open("implicit10.plt");
|
||||||
visualize(script, "implicit10.txt", time_end);
|
visualize(script, "implicit10.txt", time_end);
|
||||||
script.close();
|
script.close();
|
||||||
|
|
||||||
script.open("es5.plt");
|
script.open("explicit5.plt");
|
||||||
visualize(script, "explicit5.txt", time_end);
|
visualize(script, "explicit5.txt", time_end);
|
||||||
script.close();
|
script.close();
|
||||||
|
|
||||||
script.open("is5.plt");
|
script.open("explicit5.plt");
|
||||||
visualize(script, "implicit5.txt", time_end);
|
visualize(script, "implicit5.txt", time_end);
|
||||||
script.close();
|
script.close();
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user