Добавьте файлы проекта.

This commit is contained in:
Anton Kamalov
2025-05-13 20:24:51 +03:00
parent 8fab8f453f
commit 47b39d658d
27 changed files with 1758901 additions and 0 deletions

42
MemMAPR_winda.sln Normal file
View File

@@ -0,0 +1,42 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.12.35707.178
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Main_program", "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
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{86DC468D-3A9F-48AB-80FC-059A120499AA}.Debug|Any CPU.ActiveCfg = Debug|x64
{86DC468D-3A9F-48AB-80FC-059A120499AA}.Debug|Any CPU.Build.0 = Debug|x64
{86DC468D-3A9F-48AB-80FC-059A120499AA}.Debug|x64.ActiveCfg = Debug|x64
{86DC468D-3A9F-48AB-80FC-059A120499AA}.Debug|x64.Build.0 = Debug|x64
{86DC468D-3A9F-48AB-80FC-059A120499AA}.Debug|x86.ActiveCfg = Debug|Win32
{86DC468D-3A9F-48AB-80FC-059A120499AA}.Debug|x86.Build.0 = Debug|Win32
{86DC468D-3A9F-48AB-80FC-059A120499AA}.Release|Any CPU.ActiveCfg = Release|x64
{86DC468D-3A9F-48AB-80FC-059A120499AA}.Release|Any CPU.Build.0 = Release|x64
{86DC468D-3A9F-48AB-80FC-059A120499AA}.Release|x64.ActiveCfg = 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.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
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

171
MemMAPR_winda.vcxproj Normal file
View File

@@ -0,0 +1,171 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>17.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{86dc468d-3a9f-48ab-80fc-059a120499aa}</ProjectGuid>
<RootNamespace>MemMAPRwinda</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>MemMAPR_main</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ExternalIncludePath>C:\Users\fanof\source\repos\MemMAPR_winda\include;$(ExternalIncludePath)</ExternalIncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ExternalIncludePath>C:\Users\fanof\source\repos\MemMAPR_winda\include;$(ExternalIncludePath)</ExternalIncludePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="src\Form.cpp" />
<ClCompile Include="src\main.cpp" />
<ClCompile Include="src\Mesh.cpp" />
<ClCompile Include="src\Node.cpp" />
<ClCompile Include="src\Object.cpp" />
<ClCompile Include="src\Primitives.cpp" />
<ClCompile Include="src\Solver.cpp" />
<ClCompile Include="src\System.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="include\Form.hpp" />
<ClInclude Include="include\Mesh.hpp" />
<ClInclude Include="include\Node.hpp" />
<ClInclude Include="include\Object.hpp" />
<ClInclude Include="include\Primitives.hpp" />
<ClInclude Include="include\Solver.hpp" />
<ClInclude Include="include\System.hpp" />
</ItemGroup>
<ItemGroup>
<Text Include="explicit10.txt" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="packages\Eigen.3.3.3\build\native\Eigen.targets" Condition="Exists('packages\Eigen.3.3.3\build\native\Eigen.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>Данный проект ссылается на пакеты NuGet, отсутствующие на этом компьютере. Используйте восстановление пакетов NuGet, чтобы скачать их. Дополнительную информацию см. по адресу: http://go.microsoft.com/fwlink/?LinkID=322105. Отсутствует следующий файл: {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('packages\Eigen.3.3.3\build\native\Eigen.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Eigen.3.3.3\build\native\Eigen.targets'))" />
</Target>
</Project>

View File

@@ -0,0 +1,72 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Исходные файлы">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Файлы заголовков">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Файлы ресурсов">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\Form.cpp">
<Filter>Исходные файлы</Filter>
</ClCompile>
<ClCompile Include="src\main.cpp">
<Filter>Исходные файлы</Filter>
</ClCompile>
<ClCompile Include="src\Mesh.cpp">
<Filter>Исходные файлы</Filter>
</ClCompile>
<ClCompile Include="src\Node.cpp">
<Filter>Исходные файлы</Filter>
</ClCompile>
<ClCompile Include="src\Object.cpp">
<Filter>Исходные файлы</Filter>
</ClCompile>
<ClCompile Include="src\Primitives.cpp">
<Filter>Исходные файлы</Filter>
</ClCompile>
<ClCompile Include="src\Solver.cpp">
<Filter>Исходные файлы</Filter>
</ClCompile>
<ClCompile Include="src\System.cpp">
<Filter>Исходные файлы</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="include\Form.hpp">
<Filter>Файлы заголовков</Filter>
</ClInclude>
<ClInclude Include="include\Mesh.hpp">
<Filter>Файлы заголовков</Filter>
</ClInclude>
<ClInclude Include="include\Node.hpp">
<Filter>Файлы заголовков</Filter>
</ClInclude>
<ClInclude Include="include\Object.hpp">
<Filter>Файлы заголовков</Filter>
</ClInclude>
<ClInclude Include="include\Primitives.hpp">
<Filter>Файлы заголовков</Filter>
</ClInclude>
<ClInclude Include="include\Solver.hpp">
<Filter>Файлы заголовков</Filter>
</ClInclude>
<ClInclude Include="include\System.hpp">
<Filter>Файлы заголовков</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Text Include="explicit10.txt" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
</Project>

10
es10.plt Normal file
View File

@@ -0,0 +1,10 @@
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 Normal file
View File

@@ -0,0 +1,10 @@
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

0
explicit10.txt Normal file
View File

777900
explicit5.txt Normal file

File diff suppressed because it is too large Load Diff

201800
implicit10.txt Normal file

File diff suppressed because it is too large Load Diff

777900
implicit5.txt Normal file

File diff suppressed because it is too large Load Diff

28
include/Form.hpp Normal file
View File

@@ -0,0 +1,28 @@
#ifndef MIMAPR_FORM_H
#define MIMAPR_FORM_H
#include <iostream>
#include <algorithm>
#include <cmath>
#include <map>
class Form {
protected:
static size_t counter_;
size_t id_;
bool excluded_;
int _boundtype;
public:
Form();
virtual double Function(double, double);
virtual std::pair<double, double> Deriative(double, double);
virtual bool Inhere(double, double);
virtual std::pair<double, double> missX(double);
virtual std::pair<double, double> missY(double);
virtual std::pair<double, double> size();
virtual int GetB();
bool Excluded() const;
bool operator==(size_t) const;
};
#endif

29
include/Mesh.hpp Normal file
View File

@@ -0,0 +1,29 @@
#ifndef MIMAPR_MESH_H
#define MIMAPR_MESH_H
#include <vector>
#include "Object.hpp"
#include "Node.hpp"
class Mesh{
std::vector<std::vector<Node*>> _mesh;
std::vector<Node*> _hlines;
std::vector<Node*> _vlines;
Object& _obj;
double _step;
void LinkX();
void LinkY();
void Delnode(int, int);
void Adapt();
public:
Mesh(Object&, double);
void ShowLinks();
std::vector<std::vector<Node*>>& Nodes();
std::vector<Node*>& LineX();
std::vector<Node*>& LineY();
~Mesh();
};
#endif

34
include/Node.hpp Normal file
View File

@@ -0,0 +1,34 @@
#ifndef MIMAPR_NODE_H
#define MIMAPR_NODE_H
#include <cmath>
class Node{
double _x;
double _y;
double _t;
int _btype;
Node* _left;
Node* _right;
Node* _above;
Node* _below;
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), _below(nullptr), _btype(type) {}
double T() const;
double X() const;
double Y() const;
double Dist(const Node*) const;
void LinkX(Node*, Node*);
void LinkY(Node*, Node*);
Node*& l();
Node*& r();
Node*& u();
Node*& d();
void SetT(double);
bool IsBound();
void SetB(int);
};
#endif

30
include/Object.hpp Normal file
View File

@@ -0,0 +1,30 @@
#ifndef MIMAPR_OBJECT_H
#define MIMAPR_OBJECT_H
#include "Primitives.hpp"
#include <vector>
class Object {
private:
std::vector<Form*> forms_;
double _w;
double _h;
void Updsize();
public:
Object();
~Object();
double Inhere(double, double);
double Width() const;
double Height() const;
bool Add_Form(const std::string&, std::map<std::string, double>&, bool, int);
std::pair<double, double> Filly(double, double);
std::pair<double, double> Fillx(double, double);
//std::vector<size_t> Get_IDs();
Form* Who(double, double);
};
#endif

54
include/Primitives.hpp Normal file
View File

@@ -0,0 +1,54 @@
#ifndef MIMAPR_PRIMITIVES_H
#define MIMAPR_PRIMITIVES_H
#include "Form.hpp"
class Rectangle : public Form {
private:
double a_;
double b_;
double h_x_;
double h_y_;
public:
Rectangle(double, double, double, double, bool, int);
double Function(double, double) override;
std::pair<double, double> Deriative(double, double) override;
bool Inhere(double, double) override;
std::pair<double, double> missX(double) override;
std::pair<double, double> missY(double) override;
std::pair<double, double> size() override;
};
class Circle : public Form {
private:
double a_;
double b_;
double h_x_;
double h_y_;
public:
Circle(double, double, double, double, bool, int);
double Function(double, double) override;
std::pair<double, double> Deriative(double, double) override;
bool Inhere(double, double) override;
std::pair<double, double> missX(double) override;
std::pair<double, double> missY(double) override;
std::pair<double, double> size() override;
};
class Arc : public Form {
private:
double a_;
double b_;
double h_x_;
double h_y_;
public:
Arc(double, double, double, double, bool, int);
double Function(double, double) override;
std::pair<double, double> Deriative(double, double) override;
std::pair<double, double> missX(double) override;
std::pair<double, double> missY(double) override;
std::pair<double, double> size() override;
bool Inhere(double, double) override;
};
#endif

21
include/Solver.hpp Normal file
View File

@@ -0,0 +1,21 @@
#ifndef SOLVER_H
#define SOLVER_H
#include <System.hpp>
#include <string>
#include <fstream>
class Solver{
double delta;
std::vector<double> ThomasMethod(std::vector<std::vector<double>>&, std::vector<double>&) const;
void SolveLine(System&, std::vector<Node*>&) const;
std::string _name_1;
std::string _name_2;
public:
Solver(std::string name_1, std::string name_2, double dt = 1.): delta(dt), _name_1(name_1), _name_2(name_2) {}
void SolveExplicit(System&, double) const;
void SolveImplicit(System&, double) const;
};
#endif

24
include/System.hpp Normal file
View File

@@ -0,0 +1,24 @@
#ifndef SYSTEM_H
#define SYSTEM_H
#include "Mesh.hpp"
class System{
Object& _obj;
Mesh _mesh;
double _a1;
double _a2;
double _step;
public:
System(Object& obj, double step = 10., double a1 = 1., double a2 = 1.): _obj(obj), _mesh(obj, step), _a1(a1), _a2(a2), _step(step) {}
void DefineBounds(int, int, int, int);
std::vector<std::vector<Node*>>& Nodes();
std::vector<Node*>& LineX();
std::vector<Node*>& LineY();
double step() const { return _step; }
double a1() const { return _a1; };
double a2() const { return _a2; };
};
#endif

10
is10.plt Normal file
View File

@@ -0,0 +1,10 @@
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 Normal file
View File

@@ -0,0 +1,10 @@
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

4
packages.config Normal file
View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Eigen" version="3.3.3" targetFramework="native" />
</packages>

43
src/Form.cpp Normal file
View File

@@ -0,0 +1,43 @@
#include "Form.hpp"
size_t Form::counter_ = 0;
double Form::Function(double, double) {
return 0;
}
std::pair<double, double> Form::Deriative(double, double) {
return { 0, 0 };
}
std::pair<double, double> Form::size() {
return { 0, 0 };
}
bool Form::Inhere(double, double) {
return false;
}
std::pair<double, double> Form::missX(double) {
return { 0, 0 };
}
std::pair<double, double> Form::missY(double) {
return { 0, 0 };
}
Form::Form() {
id_ = counter_++;
excluded_ = false;
_boundtype = -1;
}
bool Form::Excluded() const {
return excluded_;
}
int Form::GetB() { return _boundtype; }
bool Form::operator==(size_t id) const {
return id_ == id;
}

165
src/Mesh.cpp Normal file
View File

@@ -0,0 +1,165 @@
#include "Mesh.hpp"
#include <iostream>
#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*>());
for (double x = 0.0; x <= _obj.Width(); x += _step) {
_mesh.back().push_back(new Node(x, y));
}
}
LinkX();
LinkY();
Adapt();
}
void Mesh::LinkX() {
for (int i = 0; i < _mesh.size(); i++) {
_mesh[i][0]->LinkX(nullptr, _mesh[i][1]);
for (int j = 1; j < _mesh[i].size() - 1; j++)
_mesh[i][j]->LinkX(_mesh[i][j - 1], _mesh[i][j + 1]);
_mesh[i].back()->LinkX(_mesh[i][_mesh[i].size() - 2], nullptr);
}
for (int i = 0; i < _mesh.size(); i++)
_hlines.push_back(_mesh[i][0]);
}
void Mesh::LinkY() {
for (int j = 0; j < _mesh[0].size(); j++) {
_mesh[0][j]->LinkY(nullptr, _mesh[1][j]);
for (int i = 1; i < _mesh.size() - 1; i++)
_mesh[i][j]->LinkY(_mesh[i - 1][j], _mesh[i + 1][j]);
_mesh[_mesh.size() - 1][j]->LinkY(_mesh[_mesh.size() - 2][j], nullptr);
}
for (int i = 0; i < _mesh[0].size(); i++)
_vlines.push_back(_mesh[0][i]);
}
void Mesh::Adapt() {
for (int i = 0; i < _mesh.size(); i++) {
int s = _mesh[i].size();
for (int j = 0; j < s; j++) {
if (!_obj.Inhere(_mesh[i][j]->X(), _mesh[i][j]->Y())) {
Delnode(i, j);
j--;
s--;
}
}
}
}
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';
}
}
void Mesh::Delnode(int i, int j) {
Node* node = _mesh[i][j];
double bndX1 = _obj.Fillx(node->X(), node->Y()).first;
double bndX2 = _obj.Fillx(node->X(), node->Y()).second;
double bndY1 = _obj.Filly(node->X(), node->Y()).first;
double bndY2 = _obj.Filly(node->X(), node->Y()).second;
int btype = _obj.Who(node->X(), node->Y())->GetB();
if (node->l()) {
if (node->l()->X() != bndX2 && node->l()->X() != bndX1) {
if (bndX1 != bndX2) {
Node* left = new Node(bndX2, node->Y(), btype);
Node* right = new Node(bndX1, node->Y(), btype);
node->l()->r() = left;
if (node->r())
node->r()->l() = right;
left->LinkX(node->l(), right);
right->LinkX(left, node->r());
node->l() = right;
_mesh[i].push_back(left);
_mesh[i].push_back(right);
}
else {
Node* left = new Node(bndX2, node->Y(), btype);
node->l()->r() = left;
if (node->r())
node->r()->l() = left;
left->LinkX(node->l(), node->r());
node->l() = left;
_mesh[i].push_back(left);
}
}
else
node->l()->r() = node->r();
}
if (node->r()) {
node->r()->l() = node->l();
}
if (node->d()) {
if (node->d()->Y() != bndY2 && node->d()->Y() != bndY1) {
if (bndY2 != bndY1) {
Node* down = new Node(node->X(), bndY2, btype);
Node* up = new Node(node->X(), bndY1, btype);
node->d()->u() = down;
if (node->u())
node->u()->d() = up;
down->LinkY(node->d(), up);
up->LinkY(down, node->u());
node->d() = up;
_mesh[i].push_back(down);
_mesh[i].push_back(up);
}
else {
Node* down = new Node(node->X(), bndY2, btype);
node->d()->u() = down;
if (node->u())
node->u()->d() = down;
down->LinkY(node->d(), node->u());
node->d() = down;
_mesh[i].push_back(down);
}
}
else
node->d()->u() = node->u();
}
if (node->u()) {
node->u()->d() = node->d();
}
_mesh[i].erase(_mesh[i].begin() + j);
delete node;
}
std::vector<std::vector<Node*>>& Mesh::Nodes() { return _mesh; }
std::vector<Node*>& Mesh::LineX() { return _hlines; }
std::vector<Node*>& Mesh::LineY() { return _vlines; }
Mesh::~Mesh() {
for (auto line : _mesh)
for (auto node : line)
delete node;
}

87
src/Node.cpp Normal file
View File

@@ -0,0 +1,87 @@
#include "Node.hpp"
#include <iostream>
double Node::X() const { return _x; }
double Node::Y() const { return _y; }
double Node::T() const {
if (_btype == 1)
return 100.;
if (_btype == 2) {
if (!_left)
if (_right)
return _right->T();
if (!_right)
if (_left)
return _left->T();
if (!_above)
if (_below)
return _below->T();
if (!_below)
if (_above)
return _above->T();
if (_right && _left) {
if (_right->IsBound())
return _left->T();
return _right->T();
}
if (_above && _below) {
if (_above->IsBound())
return _below->T();
return _above->T();
}
}
if (_btype == 3) {
if (!_left)
if (_right)
return _right->T() / (1 + Dist(_right));
if (!_right)
if (_left)
return _left->T() / (1 + Dist(_left));
if (!_above)
if (_below)
return _below->T() / (1 + Dist(_below));
if (!_below)
if (_above)
return _above->T() / (1 + Dist(_above));
if (_right && _left) {
if (_right->IsBound())
return _left->T() / (1 + Dist(_left));
return _right->T() / (1 + Dist(_right));
}
if (_above && _below) {
if (_above->IsBound())
return _below->T() / (1 + Dist(_below));
return _above->T() / (1 + Dist(_above));
}
}
return _t;
}
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::r() { return _right; }
Node*& Node::u() { return _above; }
Node*& Node::d() { return _below; }
void Node::LinkX(Node* l, Node* r) {
_left = l;
_right = r;
}
void Node::LinkY(Node* d, Node* u) {
_below = d;
_above = u;
}
void Node::SetT(double t) {
_t = t;
}
bool Node::IsBound() { return _btype; }
void Node::SetB(int type) { _btype = type; }

97
src/Object.cpp Normal file
View File

@@ -0,0 +1,97 @@
#include "Object.hpp"
Object::Object() : _w(0), _h(0) {}
double Object::Inhere(double x, double y) {
for (auto form : forms_) {
if (form->Excluded()) {
if (form->Inhere(x, y)) {
return false;
}
}
else {
if (form->Inhere(x, y)) {
return true;
}
}
}
return false;
}
void Object::Updsize() {
for (auto form : forms_) {
_w = std::max(_w, form->size().first);
_h = std::max(_h, form->size().second);
}
}
bool Object::Add_Form(const std::string& name, std::map<std::string, double>& args, bool excluded, int btype) {
if (name == "Rectangle") {
forms_.push_back(new Rectangle(args["a"], args["b"], args["h_x"], args["h_y"], excluded, btype));
Updsize();
return true;
}
else if (name == "Circle") {
forms_.push_back(new Circle(args["a"], args["b"], args["h_x"], args["h_y"], excluded, btype));
Updsize();
return true;
}
else if (name == "Arc") {
forms_.push_back(new Arc(args["a"], args["b"], args["h_x"], args["h_y"], excluded, btype));
Updsize();
return true;
}
return false;
}
std::pair<double, double> Object::Fillx(double x, double y) {
for (auto form : forms_) {
if (form->Inhere(x, y)) {
return form->missX(y);
}
}
return { 0, 0 };
}
std::pair<double, double> Object::Filly(double x, double y) {
for (auto form : forms_) {
if (form->Inhere(x, y)) {
return form->missY(x);
}
}
return { 0, 0 };
}
double Object::Width() const {
return _w;
}
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)) {
return form;
}
}
return forms_.back();
}
Object::~Object() {
for (auto form : forms_)
delete form;
}

98
src/Primitives.cpp Normal file
View File

@@ -0,0 +1,98 @@
#include "Primitives.hpp"
Rectangle::Rectangle(double a, double b, double h_x, double h_y, bool excluded, int btype) : a_(a), b_(b), h_x_(h_x), h_y_(h_y) {
excluded_ = excluded;
_boundtype = btype;
}
std::pair<double, double> Rectangle::missX(double y) {
return { 0.5 / h_x_ + a_, -0.5 / h_x_ + a_ };
}
std::pair<double, double> Rectangle::missY(double x) {
return { 0.5 / h_y_ + b_, -0.5 / h_y_ + b_ };
}
std::pair<double, double> Rectangle::size() {
return { 1 / h_x_, 1 / h_y_ };
}
double Rectangle::Function(double x, double y) {
return std::max(h_x_ * std::abs(x - a_), h_y_ * std::abs(y - b_));
}
std::pair<double, double> Rectangle::Deriative(double x, double y) {
return { (h_x_ / 2) * ((x - a_) / std::abs(x - a_)), (h_y_ / 2) * ((y - b_) / std::abs(y - b_)) };
}
bool Rectangle::Inhere(double x, double y) {
return Function(x, y) <= 0.5;
}
Circle::Circle(double a, double b, double h_x, double h_y, bool excluded, int btype) : a_(a), b_(b), h_x_(h_x), h_y_(h_y) {
excluded_ = excluded;
_boundtype = btype;
}
std::pair<double, double> Circle::missY(double x) {
return { std::sqrt(1 - pow((h_x_ * (x - a_)), 2)) / h_y_ + b_, -std::sqrt(1 - pow((h_x_ * (x - a_)), 2)) / h_y_ + b_ };
}
std::pair<double, double> Circle::missX(double y) {
return { std::sqrt(1 - pow((h_y_ * (y - b_)), 2)) / h_x_ + a_, -std::sqrt(1 - pow((h_y_ * (y - b_)), 2)) / h_x_ + a_ };
}
double Circle::Function(double x, double y) {
return pow(h_x_ * (x - a_), 2) + pow(h_y_ * (y - b_), 2);
}
std::pair<double, double> Circle::Deriative(double x, double y) {
return { 2 * h_x_ * (x - a_), 2 * h_y_ * (y - b_) };
}
std::pair<double, double> Circle::size() {
return { 1 / h_x_, 1 / h_y_ };
}
bool Circle::Inhere(double x, double y) {
return Function(x, y) <= 1;
}
Arc::Arc(double a, double b, double h_x, double h_y, bool excluded, int btype) : a_(a), b_(b), h_x_(h_x), h_y_(h_y) {
excluded_ = excluded;
_boundtype = btype;
}
std::pair<double, double> Arc::missY(double x) {
return { std::sqrt(1 - pow((h_x_ * (x - a_)), 2)) / h_y_ + b_, std::sqrt(1 - pow((h_x_ * (x - a_)), 2)) / h_y_ + b_ };
}
std::pair<double, double> Arc::missX(double y) {
return { std::sqrt(1 - pow((h_y_ * (y - b_)), 2)) / h_x_ + a_, std::sqrt(1 - pow((h_y_ * (y - b_)), 2)) / h_x_ + a_ };
}
double Arc::Function(double x, double y) {
if (x >= a_ && y >= b_) {
return pow(h_x_ * (x - a_), 2) + pow(h_y_ * (y - b_), 2);
}
return -1.0;
}
std::pair<double, double> Arc::Deriative(double x, double y) {
if (x >= a_ && y >= b_) {
return { 2 * h_x_ * (x - a_), 2 * h_y_ * (y - b_) };
}
if (x < a_) {
std::cout << "x < a\n";
}
if (y < b_) {
std::cout << "y < b\n";
}
return { -1.0, -1.0 };
}
std::pair<double, double> Arc::size() {
return { 1 / h_x_, 1 / h_y_ };
}
bool Arc::Inhere(double x, double y) {
return Function(x, y) >= 1;
}

133
src/Solver.cpp Normal file
View File

@@ -0,0 +1,133 @@
#include "Solver.hpp"
void Solver::SolveExplicit(System& program, double tstop) const {
std::ofstream ExplicitOut(_name_1);
for (double t = 0.0; t < tstop; t += delta) {
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD> X */
for (int i = 1; i < program.LineX().size() - 1; i++) {
std::vector<Node*> temperature;
Node* cur = program.LineX()[i];
while (cur) {
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> */
if (cur->r() && cur->r()->X() - cur->X() > program.step()) {
temperature.push_back(cur);
SolveLine(program, temperature);
temperature.clear();
cur = cur->r();
}
else {
temperature.push_back(cur);
cur = cur->r();
}
}
SolveLine(program, temperature);
}
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD> Y */
for (int i = 1; i < program.LineY().size() - 1; i++) {
std::vector<Node*> temperature;
Node* cur = program.LineY()[i];
while (cur) {
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> */
if (cur->u() && cur->u()->Y() - cur->Y() > program.step()) {
temperature.push_back(cur);
SolveLine(program, temperature);
temperature.clear();
cur = cur->u();
}
else {
temperature.push_back(cur);
cur = cur->u();
}
}
SolveLine(program, temperature);
}
for (auto line : program.Nodes()) {
for (auto node : line)
ExplicitOut << node->X() << ' ' << node->Y() << ' ' << node->T() << '\n';
}
ExplicitOut << "\n\n";
}
}
void Solver::SolveImplicit(System& sys, double tstop) const {
std::ofstream EmplicitOut(_name_2);
for (double t = 0.; t < tstop; t += delta) {
for (auto line : sys.Nodes())
for (auto node : line) {
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> */
if (!node->IsBound()) {
/* Tx = T_right - 2T_current + T_left / delta_x ^ 2 */
/* Ty = T_upper - 2T_current + T_down / delta_y ^ 2*/
/* T_new = delta_t * a * (delta_x + delta_y) + T_current
(<28><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> a = 1) */
double tx = (node->r()->T() - 2 * node->T() + node->l()->T()) / pow(sys.step(), 2);
double ty = (node->u()->T() - 2 * node->T() + node->d()->T()) / pow(sys.step(), 2);
double t = delta * (tx + ty) + node->T();
node->SetT(t);
}
}
for (auto line : sys.Nodes()) {
for (auto node : line)
EmplicitOut << node->X() << ' ' << node->Y() << ' ' << node->T() << '\n';
}
EmplicitOut << "\n\n";
}
}
void Solver::SolveLine(System& sys, std::vector<Node*>& n) const {
int size = n.size() - 2;
double mu1 = n.front()->Dist(n[1]) / sys.step();
double mu2 = n.back()->Dist(n[n.size() - 2]) / sys.step();
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> */
if (mu2 == 0.)
mu2 = .1;
double val2 = -(2 * sys.a1()) / (pow(sys.step(), 2)) - 1 / delta;
double val1 = sys.a1() / (pow(sys.step(), 2));
std::vector<std::vector<double>> next(size);
std::vector<double> right(size);
for (int i = 0; i < next.size(); i++)
next[i].resize(3, 0.0);
next[0][0] = -(2 * sys.a1()) / (mu1 * pow(sys.step(), 2)) - 1 / delta;//val2;
next[0][1] = (2 * sys.a1()) / ((mu1 + 1) * pow(sys.step(), 2));// val1;
next.back()[1] = (2 * sys.a1()) / ((mu2 + 1) * pow(sys.step(), 2));// val1;
next.back()[2] = -(2 * sys.a1()) / (mu2 * pow(sys.step(), 2)) - 1 / delta;//val2;
for (int i = 1; i < size - 1; i++) {
next[i][0] = val1;
next[i][1] = val2;
next[i][2] = val1;
}
for (int i = 0; i < right.size(); i++)
right[i] = -n[i + 1]->T() / delta;
right.front() += -(2 * sys.a1() * n.front()->T()) / (mu1 * (mu1 + 1) * pow(sys.step(), 2));
right.back() += -(2 * sys.a1() * n.back()->T()) / (mu2 * (mu2 + 1) * pow(sys.step(), 2));
std::vector<double> tmps = ThomasMethod(next, right);
for (int i = 0; i < tmps.size(); i++)
n[i + 1]->SetT(tmps[i]);
}
std::vector<double> Solver::ThomasMethod(std::vector<std::vector<double>>& A, std::vector<double>& b) const {
int row = b.size() - 1;
std::vector<double>alpha(row);
std::vector<double>beta(row);
alpha[0] = -A[0][1] / A[0][0];
beta[0] = b[0] / A[0][0];
for (int i = 1; i < row; i++) {
double a = A[i][0];
double b1 = A[i][1];
double c = A[i][2];
alpha[i] = -c / (a * alpha[i - 1] + b1);
beta[i] = (b[i] - a * beta[i - 1]) / (a * alpha[i - 1] + b1);
}
std::vector<double> result(b.size());
result.back() = (b.back() - A.back()[1] * beta.back()) / (A.back()[2] + A.back()[1] * alpha.back());
for (int i = row - 1; i > -1; i--)
result[i] = alpha[i] * result[i + 1] + beta[i];
return result;
}

30
src/System.cpp Normal file
View File

@@ -0,0 +1,30 @@
#include "System.hpp"
void System::DefineBounds(int l, int t, int r, int b) {
Node* cur = _mesh.LineX().front();
while (cur) {
cur->SetB(b);
cur = cur->r();
}
cur = _mesh.LineX().back();
while (cur) {
cur->SetB(t);
cur = cur->r();
}
cur = _mesh.LineY().front();
while (cur) {
cur->SetB(l);
cur = cur->u();
}
cur = _mesh.LineY().back();
while (cur->u()) {
cur->SetB(r);
cur = cur->u();
}
}
std::vector<std::vector<Node*>>& System::Nodes() { return _mesh.Nodes(); }
std::vector<Node*>& System::LineX() { return _mesh.LineX(); }
std::vector<Node*>& System::LineY() { return _mesh.LineY(); }

99
src/main.cpp Normal file
View File

@@ -0,0 +1,99 @@
#include <iostream>
#include <fstream>
#include <Solver.hpp>
#define WIDTH 500.
#define HEIGHT 400.
#define ARC_RADIUS 150.
//#define SQUARE_X 355.
//#define SQUARE_Y 155.
//#define SQUARE_SIDE 100.
#define HOLE_X 355.
#define HOLE_Y 155.
#define HOLE_RADIUS 50.
void visualize(std::ofstream& file, std::string filename, int time_end) {
file << "set cbrange [" << 0 << ":" << 100 << "]" << std::endl;
file << "set size ratio " << float(400) / 500 << "\nunset key\n" << "\nset 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)\n" << std::endl;
file << "do for [i=0:" << time_end - 1 << "]{" << std::endl;
file << "plot '" << filename << "' u 1:2:3 index i w points pt 5 palette" << std::endl;
file << "pause " << 0.000000001 << "}" << std::endl;
file << "pause mouse";
}
int main()
{
int l = 3; //Bound conditions
int t = 3;
int r = 1;
int b = 3;
int r2 = 4;
int s = 3;
double step = 10; // Mesh step
double step2 = 5; // Mesh step
double time_step = 1;
double time_end = 100;
double C = 50.; // Material props
std::map<std::string, double> plate{
{"a", WIDTH / 2}, {"b", HEIGHT / 2}, {"h_x", 1 / WIDTH}, {"h_y", 1 / HEIGHT}
};
std::map<std::string, double> arc{
{"a", WIDTH - ARC_RADIUS}, {"b", HEIGHT - ARC_RADIUS}, {"h_x", 1 / ARC_RADIUS}, {"h_y", 1 / ARC_RADIUS}
};
std::map<std::string, double> circle{
{"a", HOLE_X}, {"b", HOLE_Y}, {"h_x", 1 / HOLE_RADIUS}, {"h_y", 1 / HOLE_RADIUS}
};
Object obj;
obj.Add_Form("Circle", circle, true, s);
obj.Add_Form("Arc", arc, true, r2);
obj.Add_Form("Rectangle", plate, false, 1);
System explicit10(obj, step, C);
explicit10.DefineBounds(l, t, r, b);
System explicit5(obj, step2, C);
explicit5.DefineBounds(l, t, r, b);
System implicit10(obj, step, C);
implicit10.DefineBounds(l, t, r, b);
System implicit5(obj, step2, C);
implicit5.DefineBounds(l, t, r, b);
Solver slv10("explicit10.txt", "implicit10.txt", time_step);
slv10.SolveExplicit(explicit10, time_end);
slv10.SolveImplicit(implicit10, time_end);
Solver slv5("explicit5.txt", "implicit5.txt", time_step);
slv5.SolveExplicit(explicit5, time_end);
slv5.SolveImplicit(implicit5, time_end);
std::ofstream script("es10.plt");
visualize(script, "explicit10.txt", time_end);
script.close();
script.open("is10.plt");
visualize(script, "implicit10.txt", time_end);
script.close();
script.open("es5.plt");
visualize(script, "explicit5.txt", time_end);
script.close();
script.open("is5.plt");
visualize(script, "implicit5.txt", time_end);
script.close();
return 0;
}
//std::map<std::string, double> square{
// {"a", SQUARE_X}, {"b", SQUARE_Y}, {"h_x", 1 / SQUARE_SIDE}, {"h_y", 1 / SQUARE_SIDE}
//};